<template>
  <div>
    <!-- 面包屑 -->
    <el-bread />
    <!-- 添加按钮 -->
    <el-button type="primary" style="margin-top: 10px" @click="addDiolog">添加</el-button>
    <!-- 表格 -->
    <v-list @edit="edit"/>
    <!-- 弹框 -->
    <v-dialog :isShow="isShow" :isAdd="isAdd" @cancel="cancel" ref="userRef"/>
  </div>
</template>

<script lang="ts" setup>
import vList from './list.vue'
import vDialog from './dialog.vue'
import {ref} from 'vue'
let userRef = ref<any>(null)

let isShow = ref(false)
let isAdd = ref(true)

// 添加
const addDiolog = () => {
    isShow.value = true
    isAdd.value = true
}

// 取消
const cancel = () => {
    isShow.value = false
}

// 编辑
const edit = (uid:number) => {
    isShow.value = true;
    isAdd.value = false;
    userRef.value.lookup(uid)
}
</script>

<style lang="less" scoped></style>
